<!DOCTYPE html>
<html>
<head>
    <title>预防维护工单</title>
    #parse("sys/header.html")
    <style>
        .ui-jqgrid {
            width: 100%;
            float: right;
        }

        .leftHeight {
            height: 85vh;
            overflow: auto;
        }

        ::-webkit-scrollbar {
            width: 10px;
            height: 10px;
        }

        ::-webkit-scrollbar-thumb {
            border-radius: 10px;
            -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
            background: #a8a5a5;
        }

        .workShops {
            position: absolute;
            top: 0;
            width: 100%;
            height: 25px;
            background-color: white;
        }

        .repairCss {
            display: none;
            margin: 20px;
        }

        .repairCss::-webkit-scrollbar {
            display: none;
        }

        .personnelCss {
            overflow: auto;
            height: 200px
        }

        .personnelCss::-webkit-scrollbar {
            /*display: none;*/
            width: 10px;
            height: 10px;
        }

        .personnelSelect {
            margin: 0px 3px 5px 3px;
            /*padding: 0px 3px 3px 3px;*/

        }

        .personnelMari {
            text-align: center;
            width: 90px;
        }

        .inputcss {
            border: 1px solid #E1E1E1;
            padding: 3px;
            min-height: 35px;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="3">
                    <i-input v-model="q.name" @on-enter="query" placeholder="设备名称"/>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.repairCode" @on-enter="query" placeholder="工单号"/>
                </i-col>
                <i-col span="3">
                    <Date-picker type="date" v-model="q.executeTime" show-week-numbers
                                 placeholder="请选择工单执行周次"></Date-picker>
                </i-col>
                <i-col span="3">
                    <Date-picker type="date" v-model="q.executeEndTime" show-week-numbers
                                 placeholder="请选择工单结束周次"></Date-picker>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.ticketType" placeholder="工单类别">
                        <i-option v-for="ticketType in ticketTypeList" :value="ticketType.value"
                                  :key="ticketType.value">{{ticketType.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="4">
                    <i-select v-model="q.statusArray" placeholder="工单状态" multiple>
                        <i-option v-for="ticketStatus in ticketStatusList" :value="ticketStatus.value" :key="ticketStatus.value">
                            {{ticketStatus.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("devplangc:export"))
                <i-button type="info" @click="exportData"><i class="fa fa-hand-o-up"></i>&nbsp;导出工单统计</i-button>
                #end
                #if($shiro.hasPermission("devplangc:save"))
                <i-button type="success" @click="temporary"><i class="fa fa-pencil-square-o"></i>&nbsp;新增检修计划</i-button>
                #end
                #if($shiro.hasPermission("devplangc:addExecuteUser"))
                <i-button type="info" @click="dispatchTicket"><i class="fa fa-trash-o"></i>&nbsp;派工</i-button>
                #end
                #if($shiro.hasPermission("devplangc:urge"))
                <i-button type="warning" @click="urge"><i class="fa fa-trash-o"></i>&nbsp;催办</i-button>
                #end
                #if($shiro.hasPermission("devplangc:delay"))
                <i-button type="error" @click="applyChange"><i class="fa fa-trash-o"></i>&nbsp;延期申请</i-button>
                #end
                #if($shiro.hasPermission("devplangc:delayApply"))
                <i-button type="primary" @click="delayApply"><i class="fa fa-trash-o"></i>&nbsp;延期审核</i-button>
                #end
                #if($shiro.hasPermission("devplangc:error"))
                <i-button type="info" @click="addError"><i class="fa fa-trash-o"></i>&nbsp;异常添加</i-button>
                #end
                #if($shiro.hasPermission("devplangc:save"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>

        <Row :gutter="16" style="margin: 8px 0px 0px 1px;">
            <i-col :xs="3" :sm="3" :md="3" :lg="3">
                <div class="leftHeight">
                    <div class="workShops">
                        <p class="text-center" style="font-size: 15px;">工厂/基地</p>
                    </div>
                    <div id="storeLayer" style="margin-top: 25px">
                        <ul id="storeTree" class="ztree"></ul>
                    </div>
                </div>
            </i-col>
            <i-col :xs="21" :sm="21" :md="21" :lg="21">
                <table id="jqGrid"></table>
            </i-col>
        </Row>
    </div>

    <Card v-show="showForm">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="devPlanGc" :rules="ruleValidate" :label-width="80">

            <Row>
                <i-col span="11">
                    <Form-item label="维护项" prop="createDate">
                        <i-input v-model="devPlanGc.createDate" placeholder="创建时间"/>
                    </Form-item>
                </i-col>
                <i-col span="11">
                    <Form-item label="开始时间" prop="deptCode">
                        <i-input v-model="devPlanGc.deptCode" placeholder="车间编码"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="结束时间" prop="devOption">
                        <i-input v-model="devPlanGc.devOption" placeholder="规程库ID"/>
                    </Form-item>
                </i-col>
                <i-col span="11">
                    <Form-item label="维护规程ID" prop="devGc">
                        <i-input v-model="devPlanGc.devGc" placeholder="维护规程ID"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="维护计划ID" prop="devPlan">
                        <i-input v-model="devPlanGc.devPlan" placeholder="维护计划ID"/>
                    </Form-item>
                </i-col>
                <i-col span="11">
                    <Form-item label="工序号" prop="devProceNo">
                        <i-input v-model="devPlanGc.devProceNo" placeholder="工序号"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="22">
                    <Form-item label="问题描述" prop="problemDescribe">
                        <i-input v-model="devPlanGc.problemDescribe" placeholder="问题描述"/>
                    </Form-item>
                </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                返回</i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!-- 派工时维修工列表 -->
    <div id="select" class="repairCss">
        <i-form :label-width="60">
            <Form-item label="维护人员" prop="executor">
                <i-col span="22">
                    <div class="inputcss">
                        <Row type="flex">
                            <div v-for="(item,index) in mainPersonnel" style="margin-right: 3px;margin-bottom: 3px">
                                <i-col span="24">
                                    <div>
                                        <i-button type="primary" @click="pointPopup(item,index)">
                                            {{item.name}}
                                            <i class="fa fa-trash-o"></i>
                                        </i-button>
                                    </div>
                                </i-col>
                            </div>
                        </Row>
                    </div>
                </i-col>
            </Form-item>
            <Form-item>
                <div class="personnelCss">
                    <Row type="flex">
                        <div v-for="(item,index) in repairUserList">
                            <i-col span="24">
                                <div class="personnelSelect">
                                    <i-button :type="repairUserList[index].isShow?'primary':''" size="large"
                                              @click="pointPersonnel(item)">
                                        <div class="personnelMari">
                                            {{item.userName}}
                                        </div>
                                    </i-button>
                                    <!--                                {{item.nickName + '(' + item.userName + ')'}}-->
                                </div>
                            </i-col>
                        </div>
                    </Row>
                </div>
            </Form-item>
        </i-form>
    </div>
    <div id="apply" style="display: none;padding:10px;">
        <i-form :label-width="120">
            <Row>
                <i-col span="11">
                    <Form-item label="延期时间">
                        <Date-picker type="date" :options="option" v-model="ticketChangeParam.changeTime"
                                     placeholder="请选择计划延期时间"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="22">
                    <Form-item label="事项">
                        <i-input type="textarea" v-model="ticketChangeParam.item" placeholder="变更事项"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="22">
                    <Form-item label="原因">
                        <i-input type="textarea" v-model="ticketChangeParam.reason" placeholder="问题描述"></i-input>
                    </Form-item>
                </i-col>
            </Row>
        </i-form>
    </div>
    <div id="applySwitch" style="display: none;padding:10px;">
        <i-form :label-width="120">
            <Row>
                <i-col span="11">
                    <Form-item label="审核状态">
                        <Radio-group v-model="delayCheckParam.approvalStatus">
                            <Radio :label="5"><span>通过</span></Radio>
                            <Radio :label="4"><span>不通过</span></Radio>
                        </Radio-group>
                    </Form-item>
                </i-col>
            </Row>
        </i-form>
    </div>

    <Card id="temporary" v-show="temporaryShow">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="devMaintenPlan" :rules="ruleValidate" :label-width="100">
            <Row>
                <i-col span="11">
                    <Form-item label="设备编码" prop="devCode">
                        <i-input v-model="devMaintenPlan.devCode" icon="md-arrow-dropdown-circle"
                                 @on-click="getDeviceInfo" placeholder="设备编码"/>
                    </Form-item>
                </i-col>
                <i-col span="11">
                    <Form-item label="设备名称">
                        <i-input v-model="devMaintenPlan.devName" readonly placeholder="设备名称"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="产线">
                        <i-input v-model="line" readonly placeholder="产线"/>
                    </Form-item>
                </i-col>
                <i-col span="11">
                    <Form-item label="工序">
                        <i-input v-model="proce" readonly placeholder="工序"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="开始时间">
                        <Date-picker type="date" v-model="devMaintenPlan.startDate"
                                     placeholder="工单开始时间"></Date-picker>
                    </Form-item>
                </i-col>
                <i-col span="11">
                    <Form-item label="结束时间">
                        <Date-picker type="date" v-model="devMaintenPlan.endDate"
                                     placeholder="工单结束时间"></Date-picker>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="问题描述">
                        <i-input type="textarea" v-model="devMaintenPlan.desc" placeholder="请输入问题描述"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="措施">
                        <i-input type="textarea" v-model="devMaintenPlan.step" placeholder="请输入措施"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit2('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px">
                    返回
                </i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置
                </i-button>
            </Form-item>
        </i-form>
    </Card>
</div>
<script src="${rc.contextPath}/js/device/devplangc.js?_${date.systemTime}"></script>
</body>
</html>
